package com.deco.back.controller.product;

import javax.jws.WebParam;
import javax.servlet.http.HttpServletRequest;

import com.free.common.vo.PageResponseVo;
import com.free.common.vo.PageSearchVo;
import com.free.ext.shiro.SessionManager;
import com.free.ext.web.spring.annoation.PageSearch;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.deco.domain.vo.fix.FixGeneralVo;
import com.deco.domain.vo.fix.FixTypeVo;
import com.deco.domain.vo.product.PartsCategoryVo;
import com.deco.domain.vo.product.SecurityLabelVo;
import com.deco.service.fix.FixGeneralService;
import com.deco.service.fix.FixTypeService;
import com.deco.service.product.PartsCategoryService;
import com.deco.service.product.SecurityLabelService;
import com.free.common.vo.ResultModel;

import org.springframework.web.servlet.ModelAndView;

/**
 * 广告管理 Controller
 * @author lengy
 *
 */
@Controller
public class SecurityLabelController {
    @Autowired
    private SecurityLabelService securityLabelService;

    @RequestMapping(value = "/security_label_list.do")
    public ModelAndView listPage(){
        ModelAndView mv = new ModelAndView("prod/securitylabellist");
        return mv;
    }

    @RequestMapping(value= "/security_label_list_page.do")
    @ResponseBody
    public PageResponseVo<SecurityLabelVo> getList(@PageSearch PageSearchVo<SecurityLabelVo> condition){
        return securityLabelService.pageInfo(condition);
    }

    @RequestMapping(value = "/security_label_edit.do")
    public ModelAndView editFixType(Integer id){
    	SecurityLabelVo vo = null;
        ModelAndView mv = new ModelAndView("prod/securitylabeledit");
        if(id != null){
            vo = securityLabelService.getSecurityLabel(id);
            mv.addObject("actNm","更新");
        }else{
            vo = new SecurityLabelVo();
            vo.setId(0);
            mv.addObject("actNm","新增");
        }
        mv.addObject("obj",vo);
        return mv;
    }

    @RequestMapping(value ="/security_label_del.do")
    @ResponseBody
    public ResultModel batchDelete(@RequestParam(value = "ids[]")Integer[] ids){
        return securityLabelService.batchDelete(ids);
    }

    @RequestMapping(value ="/security_label_edit_submit.do")
    @ResponseBody
    public ResultModel udpate(SecurityLabelVo vo){
        return securityLabelService.save(vo);
    }

    @RequestMapping(value ="/security_label_status.do")
    @ResponseBody
    public ResultModel updateStatus(SecurityLabelVo vo){
        return securityLabelService.save(vo);
    }

}
